<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 
        v-on:作用：事件绑定
        语法： v-on:事件名="一句话简短js/function"
        简写:   @事件名="一句话简短js/function"
    -->
    <div id="app">
      <h1>{{num}}</h1>
      <button v-on:click="num++">点击++</button>
      <button v-on:dblclick="num++">双击++</button>
      <button v-on:mouseover="num++">移入++</button>
      <hr />
      <button @click="num++">点击++</button>
      <button @dblclick="num++">双击++</button>
      <button @mouseover="num++">移入++</button>
      <hr />
      <button @click="add">点击++</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data: {
          num: 1
        },
        // 专门放函数方法了
        // js中使用data变量要加this,html不需要加this
        methods: {
          add: function () {
            this.num++
          }
        }
      })
    </script>
  </body>
</html>
